package com.link.base.base.common.dao.mybatis.mapper;

import com.link.base.base.common.model.Menu;
import com.link.base.base.common.model.MenuTree;
import com.link.base.user.model.CoreUser;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.query.QueryParams;

import java.util.List;
import java.util.Map;

/**
 * 系统菜单Mapper
 *
 * @author 郑洪达
 * @date 2019/12/12
 */

public interface MenuMapper extends BasicMapper<Menu> {

    /**
     * 根据菜单类型查询菜单列表
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> queryMenuListByTypeSelect(Menu record) throws Exception;

    /**
     * 查询权限菜单子项列表
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> querySubItemListByDutyItemIdSelect(Menu record) throws Exception;

    /**
     * 通过按钮类型查询
     * @param record
     * @return menu
     * @throws Exception
     */
    public Menu queryByMenuType(Menu record) throws Exception;

    /**
     * 查询一级菜单
     *
     * @param userId 用户ID
     * @return list
     * @throws  Exception
     */
    public List<Menu> queryFstMenuList(CoreUser userId) throws Exception;

    /**
     * 根据用户ID查询职责内DMS的所有菜单(包括一级和二级)
     *
     * @param userId 用户ID
     * @return list
     * @throws  Exception
     */
    public List<Menu> queryDmsMenuByUserId(Long userId) throws Exception;

    /**
     * 根据菜单类型获取菜单列表
     *
     * @param qps
     * @return list
     * @throws Exception
     */
    public List<Menu> getMenuListByMenuTyepSelect(QueryParams qps) throws Exception;

    /**
     * 删除菜单:根据parenId删除菜单
     *
     * @param record
     * @throws Exception
     */
    public void delMenuByParentId(Menu record) throws Exception;

    /**
     * 查询无安全性菜单的职责-二级菜单记录
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> selectDutySecondMapWithoutSecurity(Menu record) throws Exception;

    /**
     * 查询无安全性菜单的二级菜单
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> selectSecondWithoutSecurity(Menu record) throws Exception;

    /**
     * 插入安全性菜单到职责-菜单中间表
     *
     * @param record
     * @return int
     * @throws Exception
     */
    public int addMenuToDuty(Menu record) throws Exception;

    /**
     * 获取 "userId : menuId" 关联关系字符串
     *
     * @param userId
     * @return []
     */
    public Long[] getUserMenuIds(Long userId);

    /**
     *
     * @param fontQp
     * @return list
     * @throws Exception
     */
    List<Menu> handlerByAssginMenuType(Map<String, Object> fontQp) throws Exception;

    /**
     * 查询当前账套下所有菜单到安全性级别
     * @author yxl
     * @param menu
     * @return list
     * @throws Exception
     */
    public List<MenuTree> querySafetyMenuList(Menu menu) throws Exception;
}
